package com.example.dto;

import com.example.anno.State;
import com.example.bean.Base;
import jakarta.validation.constraints.*;
import jakarta.validation.groups.Default;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

/**
 *
 * @author weijingchen
 * @DateTime 2025-09-26
 */
@Data
public class ArticleDto  extends Base {
    @NotNull(groups = {update.class})
    private Integer id;//主键ID
    @NotEmpty
    @Pattern(regexp = "^\\S{1,10}$")
    @Size(min = 1, max = 10, message = "文章标题长度不能超过10个字符")
    private String title;//文章标题
    @NotEmpty
    private String content;//文章内容
    @URL
    private String coverImg;//封面图像
    @State
    private String state;//发布状态 已发布|草稿
    @NotNull
    @Min(1)//验证数字不能小于1
    private Integer categoryId;//文章分类id

    public interface add extends Default {
    }

    public interface update extends Default {
    }
}
